package thread;

/**
 * 用匿名内部类完成创建线程的两种形式
 */
public class ThreadDemo3 {
    public static void main(String[] args) {
        MyThread111 m =new MyThread111();
        Thread t1 = new Thread(m);
        Runnable runnable =new Runnable() {
            @Override
            public void run() {
                System.out.println("111");
            }
        };
   Thread t2 =new Thread(()->{

       for (int i = 0; i <100 ; i++) {
           System.out.println("起飞");
       }
   });
        t1.start();
        t2.start();
    }
}

//继承Thread重写run方法
class MyThread111 extends Thread {
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("芜湖！");
        }
    }
}
